const url = {
  local: {
    baseName: '本地',
    baseUrl: 'http://192.168.3.114:8080',
    imageUrl: 'http://192.168.3.114:8080'
  },
  dev: {
    baseName: '开发',
    baseUrl: 'https://dev.sdzhuisu.com/wst',
    imageUrl: 'https://dev.sdzhuisu.com/wst'
  },
  test: {
    baseName: '测试',
    baseUrl: 'https://test.wst.sdzhuisu.com/wst',
    imageUrl: 'https://test.wst.sdzhuisu.com/wst'
  },
  bate: {
    baseName: '内测',
    baseUrl: 'https://test.vshitang.sdzhuisu.com/wst',
    imageUrl: 'https://test.vshitang.sdzhuisu.com/wst'
  },
  prod: {
    baseName: '生产',
    baseUrl: 'https://vshitang.sdzhuisu.com/wst',
    imageUrl: 'https://vshitang.sdzhuisu.com/wst'
  }
};

export const getEnv = () => {
  let env = {};
  if (process.env.NODE_ENV === 'development') {
    env = url['local']; // 本地
    // env = url['dev']; // 开发
    // env = url['test']; // 测试
    // env = url['bate']; // 内测
    // env = url['prod']; // 生产
  } else {
    env = url['prod'];
  }

  // #ifndef APP
  showLog(env);
  // #endif
  return env;
};

function showLog(env) {
  console.log(
    `%c 环境: %c ${process.env.NODE_ENV}`,
    `background:#2d8cf0;border:1px solid #2d8cf0;padding: 2px; border-radius: 4px 0 0 4px; color: #fff;`,
    `border: 1px solid #2d8cf0;padding: 2px; border-radius: 0 4px 4px 0;color: #2d8cf0;`
  );
  console.log(
    `%c 版本: %c ${uni.getSystemInfoSync().appVersion}`,
    `background:#2d8cf0;border:1px solid #2d8cf0;padding: 2px; border-radius: 4px 0 0 4px; color: #fff;`,
    `border: 1px solid #2d8cf0;padding: 2px; border-radius: 0 4px 4px 0;color: #2d8cf0;`
  );
  console.table(env);
}
